<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <title>充值</title>
    <link rel="stylesheet" href="css/base.css" />
    <link rel="stylesheet" href="css/iconfont.css" />
    <link rel="stylesheet" href="css/recharge.css" />
    <link rel="stylesheet" href="css/all.css" />
</head>
<body>
<div>
    <div class="head">
         <span href="javascript:;" onclick="go()">
        <i class="iconfont icon-iconfontjiantou1"></i></span>
        <h1 class="titles">充值</h1>
    </div>
    <div class="middle">
        <div class="name">
            <i class="iconfont icon-weixin wechat"></i>
            <span>微信充值</span>
            <i class="iconfont icon-duihao icon-right duihao"></i>
        </div>
        <div class="name-two">
            <i class="iconfont icon-changyonglogo30 airpay"></i>
            <span>支付宝充值</span>
            <i class="iconfont icon-duihao icon-right duihao"></i>
        </div>
        <div>
            <p class="sum">充值金额</p>
            <div>
                <span class="sums">￥</span>
                <input type="text" placeholder="" class="resetUpwd-input" />
            </div>
        </div>
    </div>
    <input type="button" class="submits" value="确定"/>
</div>
<script src="js/jquery.js"></script>
<script src="js/x_rem.js"></script>
<script src="js/all.js"></script>
<script>
	var recharge = 0;  //如果是0用微信，如果是1就用支付宝
	
	$(".name-two").children(".duihao").hide();   //支付宝充值的给隐藏了
	//点击支付宝充值
	$(".name-two").click(function(){
		$(".name-two").children(".duihao").show();  //支付宝的对勾给显示了
		$(".name").children(".duihao").hide();  //微信支付的对勾给隐藏了
		recharge = 1;  //改变为1
	})
	
	//点击微信充值
	$(".name").click(function(){
		$(".name-two").children(".duihao").hide();  //支付宝的对勾给隐藏了
		$(".name").children(".duihao").show();  //微信支付的对勾给显示了
		recharge = 0;
	})
	
	
	$(".submits").click(function(){
		
		
		if(!vali(".resetUpwd-input", /^\d{0,8}\.{0,1}(\d{1,2})?$/, "充值金额必须是数字且最多两位小数")){
			
		}else{
			var data={
				money:$(".resetUpwd-input").val()
			};
			
			
			
			if(recharge == 1){
				 
				var success=(data)=>{
						localStorage.setItem('forms',JSON.stringify(data.message));//支付
						window.location.href="b.html";
				};
				Hajax("post","/recharge/aLiRecharge",data,success);
				
			}else{
				
				popup("暂时没有开通次功能");
			}
			
			
		}
			
	 
	})
	
</script>
</body>
</html>